package initialize

import (
	"fmt"
	"log"
	"os"
	"time"
)

func LoggerInit() {
	now := time.Now().Format("2006-01-02")
	sprintf := fmt.Sprintf("../log/nacos/log/%s.log", now)
	logFile, err := os.OpenFile(sprintf, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0644)
	if err != nil {
		fmt.Println("open log file failed, err:", err)
		return
	}
	log.SetOutput(logFile)
	log.SetFlags(log.Llongfile | log.Lmicroseconds | log.Ldate)
	log.Println("zap初始化成功")
}
